﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QuanLy_THPT_S4.TKB
{
    public partial class frmTKB : Form
    {
        public frmTKB()
        {
            InitializeComponent();
        }
        public Dictionary<Type, Form> OpenForm = new Dictionary<Type, Form>();


        private void CloseAll_tap()
        {
            foreach (var item in MdiChildren)
            {
                item.Close();
            }
        }

        private void ShowForm<T>(bool _kiemtra = true) where T : Form, new()
        {
            Form frm;
            OpenForm.TryGetValue(typeof(T), out frm);
            if (frm == null || frm.IsDisposed)
            {
                if (_kiemtra)
                {
                    CloseAll_tap();
                }
                frm = new T();
                OpenForm[typeof(T)] = frm;
                frm.MdiParent = this;
                frm.Show();

            }
            else
            {
                frm.Activate();
            }

        }

        private void nhậpBảnPhânCôngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ShowForm<frmPhanCongGiangDay>();
        }

        private void thuộcTínhMônHọcToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TKB.frmThuocTinhMonHoc frm = new frmThuocTinhMonHoc();
            DialogResult rs = frm.ShowDialog();
        }

        private void yêuCầuGiáoViênToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TKB.frmYeuCauGV frm = new frmYeuCauGV();
            DialogResult rs = frm.ShowDialog();
        }
    }
}
